package com.slz3.business.module.messageManagement.mesLog.steward;

import com.slz3.business.module.messageManagement.mesLog.domain.MesLog;
import com.slz3.business.module.messageManagement.mesLog.domain.MesLogCondition;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Component
public class MesLogResponse {

    @Resource
    private MesLogResController mesLogResController;

    public Mono<ServerResponse> add(ServerRequest req) {
        return req.bodyToMono(MesLog.class).flatMap(mesLog ->
                mesLogResController.add(req, mesLog)
        );
    }

    public Mono<ServerResponse> delete(ServerRequest req) {
        return req.bodyToMono(MesLogCondition.class).flatMap(mesLogCondition ->
                mesLogResController.delete(req, mesLogCondition)
        );
    }

    public Mono<ServerResponse> modify(ServerRequest req) {
        return req.bodyToMono(MesLog.class).flatMap(mesLog ->
                mesLogResController.modify(req, mesLog)
        );
    }


    public Mono<ServerResponse> list(ServerRequest req) {
        return mesLogResController.list(req);
    }

    public Mono<ServerResponse> info(ServerRequest req) {
        return mesLogResController.info(req);
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        return mesLogResController.choice(req);
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req) {
        return req.bodyToMono(MesLogCondition.class).flatMap(mesLogCondition ->
                mesLogResController.auditSubmit(req, mesLogCondition)
        );
    }

    public Mono<ServerResponse> audit(ServerRequest req) {
        return req.bodyToMono(MesLogCondition.class).flatMap(mesLogCondition ->
                mesLogResController.audit(req, mesLogCondition)
        );
    }

    public Mono<ServerResponse> auditReject(ServerRequest req) {
        return req.bodyToMono(MesLogCondition.class).flatMap(mesLogCondition ->
                mesLogResController.auditReject(req, mesLogCondition)
        );
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req) {
        return req.bodyToMono(MesLogCondition.class).flatMap(mesLogCondition ->
                mesLogResController.usingEnable(req, mesLogCondition)
        );
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req) {
        return req.bodyToMono(MesLogCondition.class).flatMap(mesLogCondition ->
                mesLogResController.usingDisable(req, mesLogCondition)
        );
    }

}
